from typing import *

class Solution:
    def maximumNumberOfStringPairs(self, words: List[str]) -> int:
        c = Counter()
        ans = 0
        for w in words:
            ans += c[w]
            c[w[::-1]]+=1
        return ans